# the minimum version of CMake.
cmake_minimum_required(VERSION 3.5.0)
project(http2)

set(NATIVERENDER_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR})

if(DEFINED PACKAGE_FIND_FILE)
    include(${PACKAGE_FIND_FILE})
endif()

set(bounds_checking_function_dir "${NATIVERENDER_ROOT_PATH}/thirdparty/third_party_bounds_checking_function")
file(GLOB_RECURSE bounds_checking_function_src "${bounds_checking_function_dir}/src/*.c")
include_directories(${NATIVERENDER_ROOT_PATH}
                    ${NATIVERENDER_ROOT_PATH}/utils/log)
add_library(http2_napi SHARED ${bounds_checking_function_src} napi/http2_napi.cpp napi/http2_napi_init.cpp utils/log/ohos_log.cpp utils/napi/napi_utils.cpp)
target_link_libraries(http2_napi PUBLIC libace_napi.z.so hilog_ndk.z uv)
target_link_libraries(http2_napi PUBLIC ${NATIVERENDER_ROOT_PATH}/thirdparty/openssl_quic/${OHOS_ARCH}/lib/libcrypto.a)
target_link_libraries(http2_napi PUBLIC ${NATIVERENDER_ROOT_PATH}/thirdparty/openssl_quic/${OHOS_ARCH}/lib/libssl.a)
target_include_directories(http2_napi PUBLIC ${NATIVERENDER_ROOT_PATH}/thirdparty/openssl_quic/${OHOS_ARCH}/include)
target_link_libraries(http2_napi PUBLIC ${NATIVERENDER_ROOT_PATH}/thirdparty/nghttp2/${OHOS_ARCH}/lib/libnghttp2.so.14)
target_include_directories(http2_napi PUBLIC ${NATIVERENDER_ROOT_PATH}/thirdparty/nghttp2/${OHOS_ARCH}/include)
target_include_directories(http2_napi PUBLIC ${NATIVERENDER_ROOT_PATH}/thirdparty/json/${OHOS_ARCH}/include)
target_include_directories(http2_napi PUBLIC ${bounds_checking_function_dir}/include)